package com.cy;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.util.Map;

/**
  *@author: Luckyh
  * @date : 2021/4/9 14:14
  */
@RestController
@RequestMapping("/consumer/template/")
public class RestConsumerController {

    @Autowired
    private RestTemplate loadRestTemplate;

    @PostMapping
    public Map<String,Object> doPost(@RequestBody Map<String,Object> map){
        String url = String.format("http://%s/provider/template", "nacos-provider");
        return loadRestTemplate.postForObject(url,map, Map.class);
    }
}
